/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui.Almacen;

import Controlador.Bean.Almacen.Almacen;
import Controlador.Service.Almacen.GestionAlmacenes;
import gui.General.Main;
import java.awt.event.KeyEvent;
import java.util.List;

/**
 *
 * @author César
 */
public class AjusteAlmacen extends javax.swing.JInternalFrame {

    /**
     * Creates new form AjusteAlmacen
     */
    public AjusteAlmacen() {
        initComponents();
        List<Almacen> datos = GestionAlmacenes.obtenerAlmacenes();
        for(int i=0; i<datos.size(); i++){
            tpAjusteAlmacen.add(datos.get(i).getNombre(), new DetalleAjuste(datos.get(i).getIdAlmacen()));
            tpAjusteAlmacen.setMnemonicAt(i, KeyEvent.VK_1+i);
        }
    }
    
    
    private static AjusteAlmacen mynp = null;

    public static AjusteAlmacen getInstance() {
        if (mynp == null) {
            mynp = new AjusteAlmacen();
            Main.getDesktop().add(mynp);
            mynp.setVisible(true);
            mynp.toFront();
        } else {
            if (mynp.isClosed() || !mynp.isVisible()) {
                mynp = new AjusteAlmacen();
                Main.getDesktop().add(mynp);
                mynp.toFront();
                mynp.setVisible(true);
            } else {
                mynp.toFront();
            }
        }



        return mynp;
    }
    
    
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tpAjusteAlmacen = new javax.swing.JTabbedPane();

        setClosable(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tpAjusteAlmacen, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 584, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tpAjusteAlmacen, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane tpAjusteAlmacen;
    // End of variables declaration//GEN-END:variables
}
